package cz.boxdesign.library.entity.dao.query;


public enum RezervaceSqlQuery implements Query {
  UNKNOWN("", 0),

  SELECT("select * from rezervace where 1=1 ", Query.SELECT),
  UPDATE("update rezervace set pujceno_do = ? where UZIVATEL_ID_U = ? and KNIHA_ID_K = ?", Query.UPDATE),
  INSERT("insert into rezervace(UZIVATEL_ID_U,KNIHA_ID_K) values(?,?)", Query.INSERT),
  DELETE("delete from rezervace where UZIVATEL_ID_U = ? and KNIHA_ID_K = ?", Query.DELETE);

  private String query;
  private Integer value;

  private RezervaceSqlQuery(String query, Integer value) {
    this.query = query;
    this.value = value;
  }

  /* (non-Javadoc)
   * @see cz.boxdesign.library.common.dao.Queries#getQuery()
   */
  @Override
  public String getQuery() {
    return query;
  }

  /* (non-Javadoc)
   * @see cz.boxdesign.library.common.dao.Queries#getValue()
   */
  @Override
  public Integer getValue() {
    return value;
  }

  /**
   * @param value
   *          the status value
   * @return return status object by value or {@link #UNKNOWN} if not found
   */
  public static RezervaceSqlQuery getByValue(Integer value) {
    for (RezervaceSqlQuery mps : values()) {
      if (mps.getValue().equals(value)) {
        return mps;
      }
    }
    return UNKNOWN;
  }

}
